/*
 * Copyright (c) 2009 Enio Perpetuo
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * 		http://www.apache.org/licenses/LICENSE-2.0
 *  
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 *  
 */
package co.za.gvi.message;

import co.za.gvi.bind.CustomDataType;

/**
 * This class represents the message generated by a <code>REPLY</code>, 
 * <code>ERROR</code> or <code>RECEIPT</code> and it is passed as a parameter
 * to the <code>IncomeMessageHandler</code> by the call-back post.
 * 
 * @see co.za.gvi.handler.IncomeMessageHandler
 * 
 * @author Enio Perpetuo
 */
public class ResponseMessage {
	
	private String responseDateTime;
	private String msisdn;
	private String responseType;
	private String statusCode;
	private String statusReason;
	private String response;
	private CustomDataType customData;
	
	public enum Type {
		REPLY,
		ERROR,
		RECEIPT;
	}
	
	/**
	 * @return the responseDateTime
	 */
	public String getResponseDateTime() {
		return responseDateTime;
	}
	
	/**
	 * @param responseDateTime the response date time to set
	 */
	public void setResponseDateTime(String responseDateTime) {
		this.responseDateTime = responseDateTime;
	}
	
	/**
	 * @return the msisdn
	 */
	public String getMsisdn() {
		return msisdn;
	}
	
	/**
	 * @param msisdn the msisdn to set
	 */
	public void setMsisdn(String msisdn) {
		this.msisdn = msisdn;
	}
	
	/**
	 * @return the responseType
	 */
	public String getResponseType() {
		return responseType;
	}
	
	/**
	 * @param responseType the responseType to set
	 */
	public void setResponseType(String responseType) {
		this.responseType = responseType;
	}
	
	/**
	 * @return the response
	 */
	public String getResponse() {
		return response;
	}

	/**
	 * @param response the response to set
	 */
	public void setResponse(String response) {
		this.response = response;
	}
	
	/**
	 * @return the statusCode
	 */
	public String getStatusCode() {
		return statusCode;
	}

	/**
	 * @param statusReason the statusReason to set
	 */
	public void setStatusReason(String statusReason) {
		this.statusReason = statusReason;
	}

	/**
	 * @return the statusReason
	 */
	public String getStatusReason() {
		return statusReason;
	}

	/**
	 * @param statusCode the statusCode to set
	 */
	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}

	/**
	 * @return the customData
	 */
	public CustomDataType getCustomData() {
		return customData;
	}

	/**
	 * @param customData the customData to set
	 */
	public void setCustomData(CustomDataType customData) {
		this.customData = customData;
	}
	
	@Override
	public String toString() {
		String separator = "\n\t";
		String openBracket = "{\n\t";
		String closeBracket = "\n}";
		StringBuilder builder = new StringBuilder();

		builder.append(openBracket);
		builder.append("Response Date Time: ");
		builder.append(this.getResponseDateTime());
		builder.append(separator);
		builder.append("Msisdn: ");
		builder.append(this.getMsisdn());
		builder.append(separator);
		builder.append("Response Type: ");
		builder.append(this.getResponseType());
		builder.append(separator);
		builder.append("Response: ");
		builder.append(this.getResponse());
		builder.append(separator);
		builder.append("Status Code: ");
		builder.append(this.getStatusCode());
		builder.append(separator);
		builder.append("Status Reason: ");
		builder.append(this.getStatusReason());
		builder.append(separator);
		builder.append("Custom Data: ");
		builder.append(this.getCustomData());
		builder.append(closeBracket);
		
		return builder.toString();
	}
}
